Conditions | 2 |
Paths | 1 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | // mini translator |
||
10 | const Translator = function (translations, separator = '.') { |
||
11 | this.separator = separator |
||
12 | this.translations = translations |
||
13 | |||
14 | let navigatorLang = window.navigator.language || window.navigator.userLanguage |
||
15 | let selectedLang = window.location.search.match(/(?:[\?\&])(?:lang=)(\w{2})(?:&|$)/) |
||
16 | let lang = selectedLang ? selectedLang[1] : navigatorLang |
||
17 | |||
18 | this.setLanguage(lang) |
||
19 | } |
||
20 | |||
44 | } |